package com.runshu.newsmartark.adapter;

import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.runshu.newsmartark.R;
import com.runshu.newsmartark.entity.ProDetailEntity;
import com.runshu.newsmartark.util.TextDrawableUtils;

import java.util.List;

/**
 * Demo class
 *
 * @author yu
 * @date 12/2/20
 * @decs：
 */

public class ProDetailAdapter extends BaseQuickAdapter<ProDetailEntity.ProductDetailListBean, BaseViewHolder> {
    public ProDetailAdapter(@Nullable List<ProDetailEntity.ProductDetailListBean> data) {
        super(R.layout.item_prodetail, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProDetailEntity.ProductDetailListBean item) {
        helper.setText(R.id.tv_pro_no, "流水号：" + item.getSerialNo());
        helper.setText(R.id.tv_pro_pihao, "批号：" + item.getBatchNo());
        helper.setText(R.id.tv_pro_date, "有效期：" + item.getPeriodDate());
        helper.setText(R.id.tv_pro_num, item.getHwName());
//        0是正常商品 ， 1 是委托代销
        if (item.getProType() == 0) {
            TextDrawableUtils.clearDrawables(helper.getView(R.id.tv_pro_no));
        } else if (item.getProType() == 1) {
            TextDrawableUtils.setDrawableRight(mContext, helper.getView(R.id.tv_pro_no), R.mipmap.icon_strat);
        }

    }

}